package youleche.com.controler.controler;

import java.util.LinkedList;
import java.util.List;

import youleche.com.business.BVehicleImageInfo;
import youleche.com.model.MVehicleImageInfo;

/**
 * 管理员页面所需的控制器
 * @author Administrator
 *
 */
public class AdminPageDataControler {
	/**
	 * 获取首页图片信息(轮播)
	 * @return 返回首页图片信息（只有4条）
	 * @throws Exception 异常
	 */
	public static List<MVehicleImageInfo> getHomeImageInfoForLunBo(){
		BVehicleImageInfo handler = new BVehicleImageInfo();
		try {
			List<MVehicleImageInfo> list = handler.getHomeImageInfo();
			if(list == null){
				return null;
			}
			
			List<MVehicleImageInfo> homelist = new LinkedList<MVehicleImageInfo>();
			int index = 0;
			for (MVehicleImageInfo img : list) {
				index ++;
				if(index == 5){
					break;
				}
				
				homelist.add(img);				
			}
			
			return homelist;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
}
